package com.yeyks.hotel.vo;

import cn.hutool.core.collection.CollectionUtil;
import com.yeyks.hotel.dal.domain.HotelInfo;
import com.yeyks.hotel.dal.domain.RoomCalendarVipInfo;
import com.yeyks.hotel.dal.domain.RoomInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class C2bSelectRoomCalendarVipInfoForOrderVo {

    private RoomInfo roomInfo;
    private HotelInfo hotelInfo;
    private List<RoomCalendarVipInfo> roomCalendarVipInfos;

    public Integer getMinPrice(){
        if(null != roomCalendarVipInfos && roomCalendarVipInfos.size() > 0){
            List<Integer> count = CollectionUtil.getFieldValues(roomCalendarVipInfos, "salePrice", Integer.class);
            return count.stream().min((o1, o2) -> o1 - o2).get();
        }
        return null;
    }

}
